package com.bf.xpdd.service;

import java.util.ArrayList;
import java.util.List;

import com.bf.xpdd.domain.ActivityBean;
import com.bf.xpdd.domain.ActivitySettingBean;
import com.bf.xpdd.domain.SiteBuyer;
import com.bf.xpdd.domain.SiteSeller;
import com.bf.xpdd.domain.SiteShop;
import com.bf.xpdd.domain.TaobaoItemResult;
import com.bf.xpdd.domain.SiteItem;
import com.bf.xpdd.exception.BaseException;
import com.taobao.api.ApiException;
import com.taobao.api.domain.Item;
import com.taobao.api.domain.Promotion;
import com.taobao.api.domain.UserTag;

/**
 * taobao service
 * @author Fantastic
 * @version 1.0.0 2011-06-01
 * @since 1.0.0
 */
public interface TaobaoService
{
	List<Item> getItemBySession(String sessionKey) throws BaseException;
	
	List changeSiteItem(List<Item> itemList) throws BaseException;
	
	TaobaoItemResult getItemByParameter(String sessionKey, String queryKey, long pageNo, long pageSize) throws BaseException;
	
	/**
	 * find item by id
	 * @param id
	 * @return XpddItem
	 * @throws BaseException
	 */
	List<SiteItem> findItemById(String id) throws BaseException;

	/**
	 * add discount
	 * @param sessionKey
	 * @param setting
	 * @param itemId
	 */
	List<Promotion> addDiscount(String sessionKey, ActivityBean activity, List<Long> items, ActivitySettingBean setting, long tagId);
	
	/**
	 * add tag
	 * @param sessionKey
	 * @throws ApiException
	 */
	UserTag addTag(String sessionKey, String tagName, String desc) throws BaseException;
	
	/**
	 * add tag
	 * @param sessionKey
	 * @throws ApiException
	 */
	boolean removeTag(String sessionKey, long tagId) throws BaseException;
	
	/**
	 * 添加标签用户
	 * @param sessionKey
	 * @param tagId
	 * @param nick
	 * @return
	 * @throws BaseException
	 */
	boolean addTagBuyer(String sessionKey, long tagId, String nick) throws BaseException;

	/**
	 * 
	 * @param topSession
	 * @param discountId
	 */
	boolean removeDiscount(String topSession, long discountId)  throws BaseException;

	/**
	 * 查询商品折扣信息
	 * @param sessionKey
	 * @param itemId
	 * @return
	 * @throws BaseException
	 */
	String findPromotionByItemId(String sessionKey, long itemId) throws BaseException;
	
	void findUserByNick(SiteSeller siteSeller) throws BaseException;
	
	void findUserIsExistByNick(String nick) throws BaseException;

	void removeTagUser(String topSession, long tagId, String nick) throws BaseException;

	/**
	 * 添加宝贝组宝贝定向优惠信息
	 * @param activitySettingService
	 * @param seller
	 * @param bean
	 * @param idList
	 * @return
	 * @throws BaseException
	 */
	String addPromotionFromAction(ActivitySettingService activitySettingService, SiteSeller seller, ActivityBean bean, ArrayList<Long> idList) throws BaseException;

	/**
	 * 添加当前用户所有宝贝到定向优惠信息
	 * @param activitySettingService
	 * @param seller
	 * @param bean
	 * @param idList
	 * @return
	 * @throws BaseException
	 */
	void addPromotionFromAction(ActivityService activityService, ActivityItemService itemService, ActivitySettingService activitySettingService, SiteSeller seller) throws BaseException;

	
	/**
	 * 删除宝贝的定向优惠信息
	 * @param activityService
	 * @param seller
	 * @param aid
	 * @throws BaseException
	 */
	void removePromotionByAction(ActivityService activityService, SiteSeller seller, long aid) throws BaseException;
	
	/**
	 * 删除当前用户所有定向优惠
	 * @param activityService
	 * @param seller
	 * @param aid
	 * @throws BaseException
	 */
	void removePromotionByAction(ActivityService activityService, SiteSeller seller) throws BaseException;
	
	/**
	 * 根据session查询当前用户所创建的人群标签
	 * @param sessionKey
	 * @return
	 * @throws BaseException
	 */
	List<UserTag> findTagBySessionKey(String sessionKey) throws BaseException;

	/**
	 * 收藏店铺
	 * @param shop
	 */
	void addFavorite(SiteShop shop, SiteBuyer buyer) throws BaseException;
}
